import React, { Component } from 'react'
import './index.less'
import memorys from '@/utils/memoryUtils'
import { Redirect } from 'react-router-dom'
import LayoutPublic from '@/components/layout-public'
import Routes from './routes'
import menus from './menuData'
import { connect } from 'react-redux'
/**
 * 后台管理的路由组件
 */
@connect((state) => ({ user: state.user }))
class index extends Component {
  render() {
    const user = this.props.user
    if (!user._id) {
      return <Redirect to="/login"></Redirect>
    }
    return (
      <LayoutPublic
        routes={Routes}
        {...this.props}
        menus={menus}
      ></LayoutPublic>
    )
  }
}

export default index
